package light.head.model.el;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Formula;
/**
 * 用户班级关系
 */
@Entity
@Table
@IdClass(UserClassesRelationPK.class)
public class UserClassesRelation implements Serializable{
	private static final long serialVersionUID = 4529190371794962413L;
	private Integer clc;			// 班级编号
	private Integer uc;				// 用户编号
	private Date signTime;			// 报名时间
	private Byte status;			// 状态(1.待通过 2.不通过 3.通过)
	private Integer oc;				// 机构
	
	private String ucn;				// 用户姓名
	private String ocn;				// 用户机构
	private String clcn;

	
	@Id
	@Column
	public Integer getClc() {
		return clc;
	}
	@Id
	@Column
	public Integer getUc() {
		return uc;
	}
	@Column
	public Byte getStatus() {
		return status;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getSignTime() {
		return signTime;
	}
	@Formula("(SELECT ui.realName FROM UserInfo ui WHERE ui.code = uc)")
	public String getUcn() {
		return ucn;
	}
	
	
	@Formula("(SELECT cl.name FROM Classes cl WHERE cl.code = clc)")
	public String getClcn() {
		return clcn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = (SELECT ui.oc FROM UserInfo ui WHERE ui.code = uc ))")
	public String getOcn() {
		return ocn;
	}
	
	
	
	
	public void setClc(Integer clc) {
		this.clc = clc;
	}
	public void setClcn(String clcn) {
		this.clcn = clcn;
	}
	public void setUc(Integer uc) {
		this.uc = uc;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}
	public void setUcn(String ucn) {
		this.ucn = ucn;
	}
	public void setOcn(String ocn) {
		this.ocn = ocn;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
}
